from time import *
def sort_pyz(m):
    start_time = time()
    for i2 in range(1,len(m)):
        for i in range(0,len(m)-i2):
            if(m[i]>m[i+1]):
                (m[i],m[i+1]) = (m[i+1],m[i])

    end_time = time()
    return (m,end_time-start_time)

with open("m1_sorted.txt","r") as test1:
    kr1 = test1.read().strip().split("\n")
    mas1 = sort_pyz(list(map(int, kr1)))
    print(f"{test1.name.split('.')[0]} {round(mas1[1]*1000)} millseconds")

with open("m2_reverse.txt","r") as test2:
    kr1 = test2.read().strip().split("\n")
    mas1 = sort_pyz(list(map(int, kr1)))
    print(f"{test2.name.split('.')[0]} {round(mas1[1] * 1000)} millseconds")

with open("m3_shuffle.txt","r") as test3:
    kr1 = test3.read().strip().split("\n")
    mas1 = sort_pyz(list(map(int, kr1)))
    print(f"{test3.name.split('.')[0]} {round(mas1[1] * 1000)} millseconds")